package com.zyj.test.month1.day13;

/**
 * @author Yijia Zhang
 * @create 2024-05-30 22:01
 */
public class code0026 {
    public int removeDuplicates(int[] nums) {
        int len = nums.length;
        int idx = 0;
        for (int i = 0; i < len; i++) {
            int num = nums[i];
            if (i == 0 || num != nums[i - 1]) {
                nums[idx++] = num;
            }
        }
        return idx;
    }
}
